home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Design
/
WB Collection.iso
/
datatypes
/
debox_dt
/
source
/
deboxcrc.asm
< prev
next >
Wrap
Assembly Source File
|
1996-04-07
|
978b
|
51 lines
******************************************************************************
*
* Flowerpower's DeBox Datatype
*
* Written by Christian Buchner and David N. Junod
*
******************************************************************************
* DeBoxCRC.asm
*
SECTION Code,CODE
* _DeBoxCRC ******************************************************************
; --- DeBoxCRC ---
;
; a0: pointer to DeboxHeader
;
; -> d0: TRUE if header is okay
;
XDEF _DeBoxCRC
_DeBoxCRC move.b (a0)+,d1 ; save CRC
cmp.b #1,(a0) ; check headermark
bne.s .false
move.w d2,-(sp) ; calculate checksum
move.b #1,d0 ; start value
move.w #15-1,d2
.loop add.b (a0)+,d0
ror.b #1,d0
dbra d2,.loop
move.w (sp)+,d2
cmp.b d0,d1 ; compare checksum
bne.s .false
.correct moveq #-1,d0 ; TRUE: header okay
.exit rts
.false moveq #0,d0 ; FALSE: header NOT okay
rts
******************************************************************************
END